Skip to content

Resolves #67 by changing Servo constructors and adding destructors#110

Draft
fwacer wants to merge 1 commit intoarduino-libraries:masterfrom
fwacer:max_servos_destructor
Draft

Resolves #67 by changing Servo constructors and adding destructors#110
fwacer wants to merge 1 commit intoarduino-libraries:masterfrom
fwacer:max_servos_destructor

Conversation

@fwacer
Copy link
Copy Markdown

@fwacer fwacer commented Apr 25, 2023

Resolves #67 by changing Servo constructors and adding destructors. The constructor looks for an unused Servo to re-use first, before adding onto the end of the array.

So far this is untested on hardware.

I'm a little uncertain that changing "ServoCount" to "MAX_SERVOS" in the following lines is ok. As far as I can tell, it's just trying to keep the code from operating out of bounds on the servo array.

if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {

if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive == true )

Resolves arduino-libraries#67 by changing Servo constructors and adding destructors.
Constructor looks for an unused Servo to re-use first, before adding onto the end of the array.
@fwacer fwacer marked this pull request as draft April 25, 2023 06:46
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 25, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Copy Markdown

Memory usage change @ 987fb8f

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 🔺 +264 - +272 +0.03 - +0.03 💚 -8 - 0 -0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 +270 - +270 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
Click for full report table
Board examples/Knob
flash
% examples/Knob
RAM for global variables
% examples/Sweep
flash
% examples/Sweep
RAM for global variables
%
arduino:mbed_nano:nano33ble 272 0.03 -8 -0.0 264 0.03 0 0.0
arduino:mbed_nano:nanorp2040connect 270 0.0 0 0.0 270 0.0 0 0.0
arduino:mbed_portenta:envie_m7:target_core=cm4 N/A N/A N/A N/A N/A N/A N/A N/A
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/Knob<br>flash,%,examples/Knob<br>RAM for global variables,%,examples/Sweep<br>flash,%,examples/Sweep<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,272,0.03,-8,-0.0,264,0.03,0,0.0
arduino:mbed_nano:nanorp2040connect,270,0.0,0,0.0,270,0.0,0,0.0
arduino:mbed_portenta:envie_m7:target_core=cm4,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: code Related to content of the project itself type: enhancement Proposed improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MAX_SERVOS limit when testing

3 participants